<%@ taglib prefix="app" uri="/app-tags"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

<tiles:insertTemplate template="/tiles/layout.jsp">
	<tiles:putAttribute name="selected" value="usuarios" />
	<tiles:putAttribute name="submenu">
        <ul>
            <li><a href="${pageContext.request.contextPath}/users/list-users.action" class="users">Lista de usuarios</a></li>
			<li><a href="${pageContext.request.contextPath}/users/add-user.action" class="useradd">Nuevo usuario</a></li>
		</ul>
	</tiles:putAttribute>
	
	<tiles:putAttribute name="body">
		<app:tablefilter tableId="usuarios"/>
		<div id="box"> 
        <h3>Usuarios</h3> 
			<table id="usuarios" width="100%"> 
				<thead> 
					<tr>
						<th width="40px">ID</th> 
						<th>Nombre completo</th>
						<th>Usuario</th>
						<th width="70px">Acciones</th> 
					</tr> 
					</thead> 
					<tbody>
					<c:forEach var="user" items="${users}">
						<tr>
							<td><c:out value="${user.id}" /></td>
							<td><c:out value="${user.firstName} ${user.lastName}" /></td>
							<td><c:out value="${user.username}" /></td>
							<td>
								<a href="${pageContext.request.contextPath}/users/edit-user.action?user.id=${user.id}"><img src="${pageContext.request.contextPath}/img/icons/user_edit.png" title="Editar Usuario" width="16" height="16" /></a>
								<a href="${pageContext.request.contextPath}/users/confirm-delete.action?user.id=${user.id}"><img src="${pageContext.request.contextPath}/img/icons/user_delete.png" title="Borrar Usuario" width="16" height="16" /></a>
								<a href="${pageContext.request.contextPath}/users/list-permissions.action?user.id=${user.id}"><img src="${pageContext.request.contextPath}/img/icons/building_key.png" title="Permisos" width="16" height="16" /></a>
							</td>
						</tr>
					</c:forEach>
					</tbody>
					</table>
                </div>
	</tiles:putAttribute>
</tiles:insertTemplate>